<?php

/**
 * contact : 刘经理 19326416371
 * company : 版权所属 四川北星惯牌科技有限公司
 **/

namespace app\common\model;

use think\Model;


class Store extends Model
{

    

    const STATUS_CLOSURE = 0;
    const STATUS_NORMAL = 1;
    const STATUS_REST = 2;
    const STATUS_PAUSE = 3;


    // 表名
    protected $name = 'merchant_store';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'status_text',
        'organizeable_text'
    ];
    

    
    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3')];
    }

    public function getOrganizeableList()
    {
        return ['0' => __('Organizeable 0'), '1' => __('Organizeable 1')];
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getOrganizeableTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['organizeable']) ? $data['organizeable'] : '');
        $list = $this->getOrganizeableList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
